mui.init({
	beforeback: function(){
		return true;
	}
});

mui.plusReady(function() {
	var targetPageId = plus.storage.getItem(KeyCfg.targetPageId);
	if(!targetPageId){
		targetPageId = plus.webview.getWebviewById(appid).id;
		plus.storage.setItem(KeyCfg.targetPageId,targetPageId);
	}
	/*---------- 重置密码 ：用户名验证---------*/
	var btn_reset = CmwMcore.$('btn_reset');
	MeventMgr.onTouchstart(btn_reset,function(event,self){
		submitForm();
	});
	
	function submitForm(){
		var userName = $("#txtPhone").val();
		if (userName == null || userName == '') {
			mui.alert("请输入用户名/手机号码/邮箱！");
			return false;
		}
		var pars ={userName:userName};
		var url =UrlConfig.model_resetpwd;
		MuiEventMgr.ajax(url,{pars:pars,
		  	sfn : function(data){
		  		var result = data.result;
		  		if (result == 1) {
		  			var targetPageId = plus.webview.currentWebview().id;
					plus.storage.setItem(KeyCfg.targetPageId,targetPageId);
					var cfg = {pars:{userId:data.userId}};
					MuiEventMgr.open('identity.html',cfg);
				} else if (result == 0) {
					mui.alert("邮件发送失败！");
				} else if (result == 2) {
					mui.alert("该会员不存在!");
				} else {
					mui.alert("发送频率太高，请稍后再试！");
				}
	        		
		  	},ffn : function(err){
		  		mui.alert("获取数据失败：["+err+"]");
		  	}
		});
		
	}
});
//var old_back = mui.back;
//mui.back = function(){
//	var targetPageId = plus.storage.getItem(KeyCfg.targetPageId);
//	if(!targetPageId){
//		mui.alert("找不到 targetPageId ,无法返回上一页面!");
//		return;
//	}
//	var targetPage = plus.webview.getWebviewById(targetPageId);
//  targetPage.show();
//  mui.fire(targetPage,'reload',{});
//  plus.storage.removeItem(KeyCfg.targetPageId);
//}